package com.poetry.controller.common;

import com.poetry.domain.po.Author;
import com.poetry.exception.BasePage;
import com.poetry.exception.R;
import com.poetry.service.IAuthorService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("/author")
@Tag(name = "作者管理模块")
public class AuthorController {
    @Resource
    private IAuthorService authorService;

    @Operation(summary = "获取作者详情")
    @GetMapping("/query_author/{id}")
    public R<Author> queryById(@PathVariable("id") Integer id) {
        return authorService.queryById(id);
    }

    @Operation(summary = "作者分页查询")
    @PostMapping("/page_author")
    public R<List<Author>> queryAuthorByPage(@RequestBody BasePage basePage) {
        return authorService.queryAuthorByPage(basePage);
    }
}
